package com.rm.zeyou.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.github.pagehelper.PageInfo;
import com.rm.zeyou.entity.Technician;
import com.rm.zeyou.response.ApiRestResponse;
import com.rm.zeyou.service.BrokerPayoutDetailService;
import com.rm.zeyou.util.login.TechnicianLoginUtil;
import com.rm.zeyou.vo.request.SalesmanPayoutListVo;
import com.rm.zeyou.vo.request.SelectUserPayoutIndexVo;
import com.rm.zeyou.vo.response.ConfirmPayoutResponseVo;
import com.rm.zeyou.vo.response.SalesmanPayoutListResponseVo;
import com.rm.zeyou.vo.response.SelectUserPayoutIndexResponseVo;
import com.rm.zeyou.vo.response.UserPayoutVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 经纪人提现记录表 前端控制器
 * </p>
 *
 * @author YanYang
 * @since 2025-03-12 15:55:07
 */
@Api(tags = "经纪人提现相关")
@RestController
@RequestMapping("/api/brokerPayoutDetail")
public class BrokerPayoutDetailController {
    @Resource
    private BrokerPayoutDetailService brokerPayoutDetailService;
    @Resource
    private TechnicianLoginUtil technicianLoginUtil;


    @ApiOperation("经纪人提现页面")
    @PostMapping("selectBrokerPayoutIndex")
    @SaCheckLogin(type = "technician")
    public ApiRestResponse<SelectUserPayoutIndexResponseVo> selectBrokerPayoutIndex(@RequestBody SelectUserPayoutIndexVo requestVo){
        Technician technician = technicianLoginUtil.getTechnician();
        return brokerPayoutDetailService.selectBrokerPayoutIndex(technician,requestVo);
    }


    @ApiOperation("经纪人提现")
    @PostMapping("brokerPayout")
    @SaCheckLogin(type = "technician")
    public ApiRestResponse<Integer> brokerPayout(@RequestBody UserPayoutVo requestVo){
        Technician technician = technicianLoginUtil.getTechnician();
        return brokerPayoutDetailService.brokerPayout(technician,requestVo);
    }

    @ApiOperation("经纪人提现记录")
    @PostMapping("brokerPayoutList")
    @SaCheckLogin(type = "technician")
    public ApiRestResponse<PageInfo<SalesmanPayoutListResponseVo>> brokerPayoutList(@RequestBody SalesmanPayoutListVo requestVo){
        Technician technician = technicianLoginUtil.getTechnician();
        return brokerPayoutDetailService.brokerPayoutList(technician,requestVo);
    }

    @ApiOperation("经纪人确认提现列表")
    @PostMapping("brokerConfirmPayout")
    @SaCheckLogin(type = "technician")
    public ApiRestResponse<List<ConfirmPayoutResponseVo>> brokerConfirmPayout() {
        Technician technician = technicianLoginUtil.getTechnician();
        return brokerPayoutDetailService.brokerConfirmPayout(technician);
    }

}
